<%@ page language="java" contentType="text/html; charset=GBK" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.net.URLDecoder.*" %>
<%@ page import="weaver.systeminfo.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="weaver.conn.RecordSet" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="CustomerModifyLog" class="weaver.crm.data.CustomerModifyLog" scope="page"/>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="CustomerInfoComInfo" class="weaver.crm.Maint.CustomerInfoComInfo" scope="page"/>

<%
    response.setHeader("cache-control", "no-cache");
    response.setHeader("pragma", "no-cache");
    response.setHeader("expires", "Mon 1 Jan 1990 00:00:00 GMT");
%>

<%
    String action = Util.null2String(request.getParameter("action"));
    if (action.equals("getcrm")) {
        String id = Util.null2String(request.getParameter("id"));
        String crmname = CustomerInfoComInfo.getCustomerInfoname(id);
        out.clear();
        out.print(crmname);
        return;
    }
    if (action.equals("getanjian")) {
        String id = Util.null2String(request.getParameter("id"));
        String sql = "select anhao  from formtable_main_21 where requestid=" + id;
        String anjianname = "";
        RecordSet.execute(sql);
        if (RecordSet.next()) {
            anjianname = RecordSet.getString("anhao");
        }
        out.clear();
        out.print(anjianname);
        return;
    }
    if (action.equals("getoptions")) {
        String id = Util.null2String(request.getParameter("id"));
        String pid = Util.null2String(request.getParameter("pid"));
        String pvalue = Util.null2String(request.getParameter("pvalue"));
        String childitemid = "";
        RecordSet.execute("select childitemid from workflow_selectitem where fieldid='" + pid + "' and selectvalue=" + pvalue);
        if (RecordSet.next()) {
            childitemid = Util.null2String(RecordSet.getString("childitemid"));
        }

        if (!childitemid.equals("")) {
            RecordSet.execute("select selectvalue,selectname from workflow_selectitem where fieldid='" + id + "' and selectvalue in(" + childitemid + ")");
        }
        String ret = "";
        while (RecordSet.next()) {
            ret += ",{name:'" + RecordSet.getString("selectname") + "',value:'" + RecordSet.getString("selectvalue") + "'}";
        }
        if (ret.length() > 0) ret = ret.substring(1);
        out.clear();
        out.print("[" + ret + "]");
        return;
    }
%>
